package libretto.activity;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabBar extends TabActivity {
	private String lib, info, iscriz;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab_bar);

		Intent intent = getIntent();
		String pkg = getPackageName();
		lib = intent.getStringExtra(pkg + ".lib");
		info = intent.getStringExtra(pkg + ".info");
		iscriz = intent.getStringExtra(pkg + ".iscriz");
		Resources res = getResources();

		Intent libretto = new Intent().setClass(this, Libretto.class);
		libretto.putExtra(pkg + ".lib", lib);

		TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);

		// INFORMAZIONI
		Intent informazioni = new Intent().setClass(this, Info.class);
		informazioni.putExtra(pkg + ".info", info);

		TabSpec infoTab = tabHost
				.newTabSpec("Info")
				.setIndicator(null,
						res.getDrawable(R.drawable.ic_menu_categories))
				.setContent(informazioni);
		tabHost.addTab(infoTab);

		// LIBRETTO
		TabSpec librettoTab = tabHost
				.newTabSpec("Libretto")
				.setIndicator(null,
						res.getDrawable(R.drawable.ic_menu_database))
				.setContent(libretto);
		tabHost.addTab(librettoTab);

		// ISCRIZIONI
		Intent iscrizioni = new Intent().setClass(this, Iscrizioni.class);
		iscrizioni.putExtra(pkg + ".iscriz", iscriz);

		TabSpec iscrizTab = tabHost
				.newTabSpec("Iscrizioni")
				.setIndicator(null,
						res.getDrawable(R.drawable.ic_menu_business))
				.setContent(iscrizioni);
		tabHost.addTab(iscrizTab);
	}
}